Skip to content

Implement timed effects for Hue lights#144

Merged
chrivers merged 10 commits into
chrivers:masterfrom
duvholt:timed-effects
Jun 2, 2025
Merged

Implement timed effects for Hue lights#144
chrivers merged 10 commits into
chrivers:masterfrom
duvholt:timed-effects

Conversation

@duvholt

@duvholt duvholt commented May 28, 2025

Copy link
Copy Markdown
Contributor

Using timed_effects made it much easier to inspect the zigbee message output of running the sunrise effect, so I tweaked EffectDuration to be as accurate as possible. Unfortunately that revealed some edge cases that didn't fit the existing model which made the conversion function uglier.

To test "timed effects" send a PUT request with

{
  "on": {
    "on": true
  },
  "timed_effects": {
    "effect": "sunrise",
    "duration": 60000
  }
}

Duration is in milliseconds.

One thing that is missing is updating timed_effects.status. Since that can easily lead to concurrency issues I'll keep that out of the scope for now.

Oh, and as a bonus I added the sunset effect 🌆

{
  "on": {
    "on": true
  },
  "timed_effects": {
    "effect": "sunset",
    "duration": 60000
  }
}

@chrivers

Copy link
Copy Markdown
Owner

Hey - sorry I completely overlooked this somehow 😅

I'll take a look now!

@chrivers

Copy link
Copy Markdown
Owner

Do we know what timed_effects.status is supposed to contain? What's the expected value(s)?

Comment thread crates/hue/src/zigbee/composite.rs
Comment thread crates/hue/src/effect_duration.rs Outdated
Comment thread crates/hue/src/api/light.rs
Comment thread src/backend/z2m/backend_event.rs Outdated
@duvholt

duvholt commented Jun 2, 2025

Copy link
Copy Markdown
Contributor Author

Do we know what timed_effects.status is supposed to contain? What's the expected value(s)?

status is set to e.g. sunset while the sunset effect is still running from what I can remember. After that it goes back to no_effect.

@chrivers

chrivers commented Jun 2, 2025

Copy link
Copy Markdown
Owner

Fantastic work 👍

Let's get it merged :)

@chrivers chrivers merged commit 12d9e37 into chrivers:master Jun 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants